package com.sk.sqd.proxy;

/**
 * 代理角色
 */
public class Proxy implements Subject {

    private RealSubject realSubject;

    public void preRequest() {
        System.out.println("访问之前的预处理");
    }

    public void postRequest() {
        System.out.println("访问之后的处理");
    }

    @Override
    public void request() {
        if (realSubject == null) {
            realSubject = new RealSubject();
        }
        preRequest();
        realSubject.request();;
        postRequest();
    }

}
